From 70f3afd5481336688132ae88673e484632a32c6e Mon Sep 17 00:00:00 2001 From: umherirrender Date: Fri, 19 Jun 2015 20:05:45 +0200 Subject: [PATCH] Remove unneeded empty lines at begin of if/else/foreach body An if body must not begin with an empty line Change-Id: I62b058be337fcc85a120fcd3dadce564db59a271 --- includes/EditPage.php | 5 ++--- includes/OutputPage.php | 1 - includes/Revision.php | 4 ++-- includes/Sanitizer.php | 1 - includes/actions/UnprotectAction.php | 1 - includes/api/ApiBase.php | 2 -- includes/cache/LinkCache.php | 3 --- includes/cache/LocalisationCache.php | 2 -- includes/changes/EnhancedChangesList.php | 1 - includes/content/WikitextContent.php | 1 - includes/context/RequestContext.php | 1 - includes/db/LoadBalancer.php | 1 - includes/diff/DifferenceEngine.php | 7 ------- includes/filebackend/FSFile.php | 1 - includes/filebackend/TempFSFile.php | 1 - includes/htmlform/HTMLSelectAndOtherField.php | 1 - includes/jobqueue/JobQueue.php | 2 -- includes/media/FormatMetadata.php | 1 - includes/media/SVGMetadataExtractor.php | 1 - includes/media/XMP.php | 1 - includes/parser/LinkHolderArray.php | 1 - includes/parser/Parser.php | 2 -- includes/parser/Preprocessor_DOM.php | 1 - includes/parser/Preprocessor_Hash.php | 1 - .../ResourceLoaderWikiModule.php | 1 - includes/specialpage/SpecialPageFactory.php | 1 - includes/specials/SpecialExport.php | 1 - includes/specials/SpecialMIMEsearch.php | 1 - includes/specials/SpecialProtectedtitles.php | 2 -- includes/upload/UploadBase.php | 20 ------------------- 30 files changed, 4 insertions(+), 65 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index ee67d01d69..b439459d15 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1037,7 +1037,6 @@ class EditPage { $undo = $wgRequest->getInt( 'undo' ); if ( $undo > 0 && $undoafter > 0 ) { - $undorev = Revision::newFromId( $undo ); $oldrev = Revision::newFromId( $undoafter ); @@ -1046,8 +1045,8 @@ class EditPage { # Otherwise, $content will be left as-is. if ( !is_null( $undorev ) && !is_null( $oldrev ) && !$undorev->isDeleted( Revision::DELETED_TEXT ) && - !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) { - + !$oldrev->isDeleted( Revision::DELETED_TEXT ) + ) { $content = $this->mArticle->getUndoContent( $undorev, $oldrev ); if ( $content === false ) { diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 7322404eaf..f02f752785 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -2282,7 +2282,6 @@ class OutputPage extends ContextSource { if ( $this->mArticleBodyOnly ) { echo $this->mBodytext; } else { - $sk = $this->getSkin(); // add skin specific modules $modules = $sk->getDefaultModules(); diff --git a/includes/Revision.php b/includes/Revision.php index 9bb4d16a91..5939715b5a 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -194,8 +194,8 @@ class Revision implements IDBAccessObject { if ( !isset( $attribs['title'] ) && isset( $row->ar_namespace ) - && isset( $row->ar_title ) ) { - + && isset( $row->ar_title ) + ) { $attribs['title'] = Title::makeTitle( $row->ar_namespace, $row->ar_title ); } diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 677d5a438e..2340cd9449 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -374,7 +374,6 @@ class Sanitizer { // are changed (like in the screwed up test system) we will re-initialise the settings. $globalContext = implode( '-', compact( 'wgAllowMicrodataAttributes', 'wgAllowImageTag' ) ); if ( !$staticInitialised || $staticInitialised != $globalContext ) { - $htmlpairsStatic = array( # Tags that must be closed 'b', 'bdi', 'del', 'i', 'ins', 'u', 'font', 'big', 'small', 'sub', 'sup', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'cite', 'code', 'em', 's', diff --git a/includes/actions/UnprotectAction.php b/includes/actions/UnprotectAction.php index bc28c8ed17..559cfaf7ca 100644 --- a/includes/actions/UnprotectAction.php +++ b/includes/actions/UnprotectAction.php @@ -37,7 +37,6 @@ class UnprotectAction extends ProtectAction { } public function show() { - $this->page->unprotect(); } } diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 55f9677fda..4b76e65eee 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1056,7 +1056,6 @@ abstract class ApiBase extends ContextSource { */ protected function validateLimit( $paramName, &$value, $min, $max, $botMax = null, $enforceLimits = false ) { if ( !is_null( $min ) && $value < $min ) { - $msg = $this->encodeParamName( $paramName ) . " may not be less than $min (set to $value)"; $this->warnOrDie( $msg, $enforceLimits ); $value = $min; @@ -2646,7 +2645,6 @@ abstract class ApiBase extends ContextSource { wfDeprecated( __METHOD__, '1.25' ); $params = $this->getFinalParams( ApiBase::GET_VALUES_FOR_HELP ); if ( $params ) { - $paramsDescription = $this->getFinalParamDescription(); $msg = ''; $paramPrefix = "\n" . str_repeat( ' ', 24 ); diff --git a/includes/cache/LinkCache.php b/includes/cache/LinkCache.php index eace1eeaea..e8cc5e5b67 100644 --- a/includes/cache/LinkCache.php +++ b/includes/cache/LinkCache.php @@ -220,17 +220,14 @@ class LinkCache { $key = $nt->getPrefixedDBkey(); if ( $this->isBadLink( $key ) || $nt->isExternal() ) { - return 0; } $id = $this->getGoodLinkID( $key ); if ( $id != 0 ) { - return $id; } if ( $key === '' ) { - return 0; } diff --git a/includes/cache/LocalisationCache.php b/includes/cache/LocalisationCache.php index 5b802aa07a..276e84aaa9 100644 --- a/includes/cache/LocalisationCache.php +++ b/includes/cache/LocalisationCache.php @@ -539,13 +539,11 @@ class LocalisationCache { public function readJSONFile( $fileName ) { if ( !is_readable( $fileName ) ) { - return array(); } $json = file_get_contents( $fileName ); if ( $json === false ) { - return array(); } diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php index 19277f1073..54cde0dbee 100644 --- a/includes/changes/EnhancedChangesList.php +++ b/includes/changes/EnhancedChangesList.php @@ -330,7 +330,6 @@ class EnhancedChangesList extends ChangesList { } elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) { $link = '' . $rcObj->timestamp . ' '; } else { - $link = Linker::linkKnown( $rcObj->getTitle(), $rcObj->timestamp, diff --git a/includes/content/WikitextContent.php b/includes/content/WikitextContent.php index 3b449b6319..8beae39378 100644 --- a/includes/content/WikitextContent.php +++ b/includes/content/WikitextContent.php @@ -82,7 +82,6 @@ class WikitextContent extends TextContent { $text = $with->getNativeData(); if ( strval( $sectionId ) === '' ) { - return $with; # XXX: copy first? } diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index 4e790c0446..d1bc597087 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -380,7 +380,6 @@ class RequestContext implements IContextSource { */ public function getSkin() { if ( $this->skin === null ) { - $skin = null; Hooks::run( 'RequestContextCreateSkin', array( $this, &$skin ) ); $factory = SkinFactory::getDefaultInstance(); diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php index 99c9a14293..069185b796 100644 --- a/includes/db/LoadBalancer.php +++ b/includes/db/LoadBalancer.php @@ -538,7 +538,6 @@ class LoadBalancer { # Now we have an explicit index into the servers array $conn = $this->openConnection( $i, $wiki ); if ( !$conn ) { - return $this->reportConnectionError(); } diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index ac29ae0238..c138eec2e2 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -685,24 +685,20 @@ class DifferenceEngine extends ContextSource { $this->mCacheHit = true; // Check if the diff should be hidden from this user if ( !$this->loadRevisionData() ) { - return false; } elseif ( $this->mOldRev && !$this->mOldRev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) { - return false; } elseif ( $this->mNewRev && !$this->mNewRev->userCan( Revision::DELETED_TEXT, $this->getUser() ) ) { - return false; } // Short-circuit if ( $this->mOldRev === false || ( $this->mOldRev && $this->mNewRev && $this->mOldRev->getID() == $this->mNewRev->getID() ) ) { - return ''; } // Cacheable? @@ -726,7 +722,6 @@ class DifferenceEngine extends ContextSource { // Loadtext is permission safe, this just clears out the diff if ( !$this->loadText() ) { - return false; } @@ -859,12 +854,10 @@ class DifferenceEngine extends ContextSource { $tempFile1 = fopen( $tempName1, "w" ); if ( !$tempFile1 ) { - return false; } $tempFile2 = fopen( $tempName2, "w" ); if ( !$tempFile2 ) { - return false; } fwrite( $tempFile1, $otext ); diff --git a/includes/filebackend/FSFile.php b/includes/filebackend/FSFile.php index a75f32851f..213bb87dee 100644 --- a/includes/filebackend/FSFile.php +++ b/includes/filebackend/FSFile.php @@ -200,7 +200,6 @@ class FSFile { public function getSha1Base36( $recache = false ) { if ( $this->sha1Base36 !== null && !$recache ) { - return $this->sha1Base36; } diff --git a/includes/filebackend/TempFSFile.php b/includes/filebackend/TempFSFile.php index 312b65c1b6..46b5360000 100644 --- a/includes/filebackend/TempFSFile.php +++ b/includes/filebackend/TempFSFile.php @@ -67,7 +67,6 @@ class TempFSFile extends FSFile { break; // got it } if ( $attempt >= 5 ) { - return null; // give up } } diff --git a/includes/htmlform/HTMLSelectAndOtherField.php b/includes/htmlform/HTMLSelectAndOtherField.php index a1c0c95748..23ca3bf3aa 100644 --- a/includes/htmlform/HTMLSelectAndOtherField.php +++ b/includes/htmlform/HTMLSelectAndOtherField.php @@ -71,7 +71,6 @@ class HTMLSelectAndOtherField extends HTMLSelectField { */ function loadDataFromRequest( $request ) { if ( $request->getCheck( $this->mName ) ) { - $list = $request->getText( $this->mName ); $text = $request->getText( $this->mName . '-other' ); diff --git a/includes/jobqueue/JobQueue.php b/includes/jobqueue/JobQueue.php index b4a2184add..913aea0107 100644 --- a/includes/jobqueue/JobQueue.php +++ b/includes/jobqueue/JobQueue.php @@ -637,7 +637,6 @@ abstract class JobQueue { * @since 1.22 */ final public function getSiblingQueuesWithJobs( array $types ) { - return $this->doGetSiblingQueuesWithJobs( $types ); } @@ -661,7 +660,6 @@ abstract class JobQueue { * @since 1.22 */ final public function getSiblingQueueSizes( array $types ) { - return $this->doGetSiblingQueueSizes( $types ); } diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index 8127837419..17e3ddad0f 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -1575,7 +1575,6 @@ class FormatMetadata extends ContextSource { // If revision deleted, exit immediately if ( $file->isDeleted( File::DELETED_FILE ) ) { - return array(); } diff --git a/includes/media/SVGMetadataExtractor.php b/includes/media/SVGMetadataExtractor.php index 6c53bc59e9..8afa31b668 100644 --- a/includes/media/SVGMetadataExtractor.php +++ b/includes/media/SVGMetadataExtractor.php @@ -262,7 +262,6 @@ class SVGReader { } elseif ( $this->reader->namespaceURI == self::NS_SVG && $this->reader->nodeType == XMLReader::ELEMENT ) { - $sysLang = $this->reader->getAttribute( 'systemLanguage' ); if ( !is_null( $sysLang ) && $sysLang !== '' ) { // See http://www.w3.org/TR/SVG/struct.html#SystemLanguageAttribute diff --git a/includes/media/XMP.php b/includes/media/XMP.php index b9d0ae5868..a838355e33 100644 --- a/includes/media/XMP.php +++ b/includes/media/XMP.php @@ -638,7 +638,6 @@ class XMPReader implements LoggerAwareInterface { // Validate structures. list( $ns, $tag ) = explode( ' ', $elm, 2 ); if ( isset( $this->items[$ns][$tag]['validate'] ) ) { - $info =& $this->items[$ns][$tag]; $finalName = isset( $info['map_name'] ) ? $info['map_name'] : $tag; diff --git a/includes/parser/LinkHolderArray.php b/includes/parser/LinkHolderArray.php index 7026c5ce39..b4ca7c8e26 100644 --- a/includes/parser/LinkHolderArray.php +++ b/includes/parser/LinkHolderArray.php @@ -560,7 +560,6 @@ class LinkHolderArray { // for each found variants, figure out link holders and replace foreach ( $varRes as $s ) { - $variantTitle = Title::makeTitle( $s->page_namespace, $s->page_title ); $varPdbk = $variantTitle->getPrefixedDBkey(); $vardbk = $variantTitle->getDBkey(); diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 432e12a558..31836892f6 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3438,7 +3438,6 @@ class Parser { # SUBST if ( !$found ) { - $substMatch = $this->mSubstWords->matchStartAndRemove( $part1 ); # Possibilities for substMatch: "subst", "safesubst" or FALSE @@ -3496,7 +3495,6 @@ class Parser { # Parser functions if ( !$found ) { - $colonPos = strpos( $part1, ':' ); if ( $colonPos !== false ) { $func = substr( $part1, 0, $colonPos ); diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 56cddce70c..718ca35afb 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -154,7 +154,6 @@ class Preprocessor_DOM implements Preprocessor { $cacheable = ( $wgPreprocessorCacheThreshold !== false && strlen( $text ) > $wgPreprocessorCacheThreshold ); if ( $cacheable ) { - $cacheKey = wfMemcKey( 'preprocess-xml', md5( $text ), $flags ); $cacheValue = $wgMemc->get( $cacheKey ); if ( $cacheValue ) { diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 308ef44c99..d1ad39c55c 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -119,7 +119,6 @@ class Preprocessor_Hash implements Preprocessor { && strlen( $text ) > $wgPreprocessorCacheThreshold; if ( $cacheable ) { - $cacheKey = wfMemcKey( 'preprocess-hash', md5( $text ), $flags ); $cacheValue = $wgMemc->get( $cacheKey ); if ( $cacheValue ) { diff --git a/includes/resourceloader/ResourceLoaderWikiModule.php b/includes/resourceloader/ResourceLoaderWikiModule.php index 1561daecd6..a4d94f8fd6 100644 --- a/includes/resourceloader/ResourceLoaderWikiModule.php +++ b/includes/resourceloader/ResourceLoaderWikiModule.php @@ -291,7 +291,6 @@ class ResourceLoaderWikiModule extends ResourceLoaderModule { $pages = $this->getPages( $context ); $key = implode( '|', array_keys( $pages ) ); if ( !isset( $this->titleInfo[$key] ) ) { - $this->titleInfo[$key] = array(); $batch = new LinkBatch; foreach ( $pages as $titleText => $options ) { diff --git a/includes/specialpage/SpecialPageFactory.php b/includes/specialpage/SpecialPageFactory.php index dedfcb6afc..3786b36227 100644 --- a/includes/specialpage/SpecialPageFactory.php +++ b/includes/specialpage/SpecialPageFactory.php @@ -572,7 +572,6 @@ class SpecialPageFactory { $context->setTitle( $page->getPageTitle( $par ) ); } } elseif ( !$page->isIncludable() ) { - return false; } diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index 920d34b881..69b795d9e4 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -335,7 +335,6 @@ class SpecialExport extends SpecialPage { if ( $exportall ) { $history = WikiExporter::FULL; } else { - $pageSet = array(); // Inverted index of all pages to look up // Split up and normalize input diff --git a/includes/specials/SpecialMIMEsearch.php b/includes/specials/SpecialMIMEsearch.php index 60225ea509..6c7133f234 100644 --- a/includes/specials/SpecialMIMEsearch.php +++ b/includes/specials/SpecialMIMEsearch.php @@ -109,7 +109,6 @@ class MIMEsearchPage extends QueryPage { * Return HTML to put just before the results. */ function getPageHeader() { - return Xml::openElement( 'form', array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => wfScript() ) diff --git a/includes/specials/SpecialProtectedtitles.php b/includes/specials/SpecialProtectedtitles.php index 0e1ce53ed4..85ce78ff58 100644 --- a/includes/specials/SpecialProtectedtitles.php +++ b/includes/specials/SpecialProtectedtitles.php @@ -67,10 +67,8 @@ class SpecialProtectedtitles extends SpecialPage { * @return string */ function formatRow( $row ) { - $title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title ); if ( !$title ) { - return Html::rawElement( 'li', array(), diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index f17681cafc..426c75247c 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -288,7 +288,6 @@ abstract class UploadBase { * If there was no filename or a zero size given, give up quick. */ if ( $this->isEmptyFile() ) { - return array( 'status' => self::EMPTY_FILE ); } @@ -297,7 +296,6 @@ abstract class UploadBase { */ $maxSize = self::getMaxUploadSize( $this->getSourceType() ); if ( $this->mFileSize > $maxSize ) { - return array( 'status' => self::FILE_TOO_LARGE, 'max' => $maxSize, @@ -311,7 +309,6 @@ abstract class UploadBase { */ $verification = $this->verifyFile(); if ( $verification !== true ) { - return array( 'status' => self::VERIFICATION_ERROR, 'details' => $verification @@ -323,7 +320,6 @@ abstract class UploadBase { */ $result = $this->validateName(); if ( $result !== true ) { - return $result; } @@ -331,7 +327,6 @@ abstract class UploadBase { if ( !Hooks::run( 'UploadVerification', array( $this->mDestName, $this->mTempPath, &$error ) ) ) { - return array( 'status' => self::HOOK_ABORTED, 'error' => $error ); } @@ -380,7 +375,6 @@ abstract class UploadBase { wfDebug( "mime: <$mime> extension: <{$this->mFinalExtension}>\n" ); global $wgMimeTypeBlacklist; if ( $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) ) { - return array( 'filetype-badmime', $mime ); } @@ -394,7 +388,6 @@ abstract class UploadBase { $ieTypes = $magic->getIEMimeTypes( $this->mTempPath, $chunk, $extMime ); foreach ( $ieTypes as $ieType ) { if ( $this->checkFileExtension( $ieType, $wgMimeTypeBlacklist ) ) { - return array( 'filetype-bad-ie-mime', $ieType ); } } @@ -413,7 +406,6 @@ abstract class UploadBase { $status = $this->verifyPartialFile(); if ( $status !== true ) { - return $status; } @@ -423,7 +415,6 @@ abstract class UploadBase { if ( $wgVerifyMimeType ) { # XXX: Missing extension will be caught by validateName() via getTitle() if ( $this->mFinalExtension != '' && !$this->verifyExtension( $mime, $this->mFinalExtension ) ) { - return array( 'filetype-mime-mismatch', $this->mFinalExtension, $mime ); } } @@ -433,7 +424,6 @@ abstract class UploadBase { if ( $this->mFinalExtension == 'svg' || $mime == 'image/svg+xml' ) { $svgStatus = $this->detectScriptInSvg( $this->mTempPath, false ); if ( $svgStatus !== false ) { - return $svgStatus; } } @@ -451,7 +441,6 @@ abstract class UploadBase { Hooks::run( 'UploadVerifyFile', array( $this, $mime, &$status ) ); if ( $status !== true ) { - return $status; } @@ -480,20 +469,17 @@ abstract class UploadBase { $mime = $this->mFileProps['file-mime']; $status = $this->verifyMimeType( $mime ); if ( $status !== true ) { - return $status; } # check for htmlish code and javascript if ( !$wgDisableUploadScriptChecks ) { if ( self::detectScript( $this->mTempPath, $mime, $this->mFinalExtension ) ) { - return array( 'uploadscripted' ); } if ( $this->mFinalExtension == 'svg' || $mime == 'image/svg+xml' ) { $svgStatus = $this->detectScriptInSvg( $this->mTempPath, true ); if ( $svgStatus !== false ) { - return $svgStatus; } } @@ -509,12 +495,10 @@ abstract class UploadBase { $errors = $zipStatus->getErrorsArray(); $error = reset( $errors ); if ( $error[0] !== 'zip-wrong-format' ) { - return $error; } } if ( $this->mJavaDetected ) { - return array( 'uploadjava' ); } } @@ -522,7 +506,6 @@ abstract class UploadBase { # Scan the uploaded file for viruses $virus = $this->detectVirus( $this->mTempPath ); if ( $virus ) { - return array( 'uploadvirus', $virus ); } @@ -1076,7 +1059,6 @@ abstract class UploadBase { $chunk = strtolower( $chunk ); if ( !$chunk ) { - return false; } @@ -1100,7 +1082,6 @@ abstract class UploadBase { # check for HTML doctype if ( preg_match( "/